import torch

tensor = torch.rand(3, 4)
print(f"tensor形状为: {tensor.shape}")
print(f"tensor的数据类型为: {tensor.dtype}")
print(f"tensor的运算形式: {tensor.device}")
tensor = tensor.cuda()
print(f"tensor的运算形式: {tensor.device}")
tensor = tensor.cpu()
print(f"tensor的运算形式: {tensor.device}")